package com.szholly.plug.safe.security;

import java.util.ArrayList;
import java.util.Collection;

import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.access.SecurityConfig;
import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource;

/**
 * 定义安全元数据
 */
public class MySecurityMetadataSource implements
		FilterInvocationSecurityMetadataSource {

	private Collection<ConfigAttribute> configAttributes;
	public MySecurityMetadataSource(){
		configAttributes = new ArrayList<ConfigAttribute>();
		ConfigAttribute configAttribute = new SecurityConfig("FS");
		configAttributes.add(configAttribute);
	}
	
	@Override
	public Collection<ConfigAttribute> getAllConfigAttributes() {
		return configAttributes;
	}

	@Override
	public Collection<ConfigAttribute> getAttributes(Object arg0)
			throws IllegalArgumentException {
		return configAttributes;
	}

	@Override
	public boolean supports(Class<?> arg0) {
		return true;
	}
}